package day03;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class A04_李四Servlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        /**
         * 1.张三盖房子,两层楼 找到李四,张三说:给我盖两层楼给你100万
         *  李四只会盖一层,找王五盖第二层
         */
        resp.setContentType("text/html;charset=utf-8");
        System.out.println("李四执行了吗?");
        resp.getOutputStream().write("李四盖第一层".getBytes());
        RequestDispatcher rd = req.getRequestDispatcher("wwServlet2");
        rd.include(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
